<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>   
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>  
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>   
<%-- <c:set var="ctx" value="http://192.168.28.11/static"/>  --%>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<%
		//从cookies中读取主题名称
		String easyuiThemeName = "bootstrap";
		Cookie cookies[] = request.getCookies();
		if(cookies != null && cookies.length > 0){
			for(int i=0; i<cookies.length; i++){
				//System.out.println("cookiesName: "+cookies[i].getName()+" value:"+cookies[i].getValue());
				if(cookies[i].getName().equals("easyuiThemeName")){
					easyuiThemeName = cookies[i].getValue();
					break;
				}
			}
		}
	%>


 <link id="easyuiTheme" rel="stylesheet" type="text/css" href="${ctx}/css/easyui/themes/<%=easyuiThemeName%>/easyui.css">
 <link rel="stylesheet" type="text/css" href="${ctx}/css/easyui/themes/icon.css">
 <link rel="stylesheet" type="text/css" href="${ctx}/css/extEasyUIIcon.css">
 <link rel="stylesheet" type="text/css" href="${ctx}/css/main.css">
 <link rel="stylesheet" type="text/css" href="${ctx}/css/color.css">
 <link rel="stylesheet" type="text/css" href="${ctx}/css/table.css">
 <script type="text/javascript" src="${ctx}/js/jquery.min.js"></script>
 <script type="text/javascript" src="${ctx}/js/jquery.cookie.js"></script>
 <script type="text/javascript" src="${ctx}/js/easyui/jquery.easyui.min.js"></script>
 <script type="text/javascript" src="${ctx}/js/extEasyUI.js"></script>
 <script type="text/javascript" src="${ctx}/js/extJquery.js"></script>
 <script type="text/javascript" src="${ctx}/js/easyui/columns-ext.js"></script>
 <script type="text/javascript" src="${ctx}/js/easyui/columns-headerMenu.js"></script>
 <script type="text/javascript" src="${ctx}/js/easyui/datagrid-detailview.js"></script>
 <script type="text/javascript" src="${ctx}/js/easyui/datagrid-dnd.js"></script>
 <script type="text/javascript" src="${ctx}/js/easyui/jquery.portal.js"></script>
 <script type="text/javascript" src="${ctx}/js/easyui/easyui-validate.js"></script>
 <script type="text/javascript" src="${ctx}/js/easyui/locale/easyui-lang-zh_CN.js"></script>
 <script type="text/javascript" src="${ctx}/js/utils.js"></script>
 <script type="text/javascript" src="${ctx}/js/loading.js"></script>
 <script type="text/javascript">
 	$(function() {
 		$.ajaxSetup({ 
 			error: function (XMLHttpRequest, textStatus, errorThrown){
 				if(XMLHttpRequest.status==403){
 					alert('您没有权限访问此资源或进行此操作');
 					return false;
 				}
 			},  
 	        complete:function(XMLHttpRequest,textStatus){  
 	       	     //通过XMLHttpRequest取得响应头,sessionstatus， 
 	       		 var sessionstatus=XMLHttpRequest.getResponseHeader("sessionstatus"); 	       	     
 	             if(sessionstatus=='timeout'){   
 	                //如果超时就处理 ，指定要跳转的页面  
 				    var top = getTopWinow(); //获取当前页面的顶层窗口对象
 				    alert('登录超时, 请重新登录.'); 						    
 	                top.location.href="${pageContext.request.contextPath}"+"/system/login"; //跳转到登陆页面
 	             }   
 	         }   
 		}); 
 		
 	});

 	
 	
 	/** 
 	* 在页面中任何嵌套层次的窗口中获取顶层窗口 
 	* @return 当前页面的顶层窗口对象 
 	*/
 	function getTopWinow(){ 
		var p = window; 
		while(p != p.parent){ 
			p = p.parent; 
		} 
		return p;
	}
 </script>
 </head>
<body>

</body>
</html>